package com.lagou.edu.controller;


import com.lagou.edu.pojo.Article;
import com.lagou.edu.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.List;

@Controller
public class ArticleController {

    @Autowired
    private ArticleService articleService;

    @RequestMapping("/findAll")
    public String findAll(Model model){
        List<Article> articleList = articleService.findAll();
        model.addAttribute("list",articleList);
        return "client/index";
    }

   /* @RequestMapping("/findAll")
    public String findAll(HttpSession session){
        List<Article> articleList = articleService.findAll();
        session.setAttribute("list",articleList);
        return "client/index";
    }*/


}
